import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

	private static final long MOD = 1000000009L;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int testCases = Integer.parseInt(br.readLine());
		while (testCases-- != 0) {
			int n = Integer.parseInt(br.readLine());
			long[] a = convertToLong(br.readLine(), n);
			getMaxSubSum(a);
		}
	}

	private static void getMaxSubSum(long[] a) {
		long maxSum = 0;
		boolean maxSumFound = false;
		int numOf0 = 0;
		for(int i = 0; i < a.length; i++) {
			if(a[i] > 0) {
				maxSumFound = true;
				maxSum += a[i];
			} else if (a[i] == 0) {
				numOf0++;
			}
		}
		
		if(maxSumFound) {
			if(numOf0 != 0) {
				System.out.println(maxSum + " " + (pow(numOf0) - 1));
			} else {
				System.out.println(maxSum + " " + 1);
			}
		} else {
			Long max = Long.MIN_VALUE;
			for(int i = 0; i < a.length; i++) {
				if(a[i] <= 0) {
					max = Math.max(max, a[i]);
				}
			}
			if(max == 0) {
				System.out.println(0 + " " + (pow(numOf0) - 1));
			} else {
				System.out.println(max + " " + (countNum(a, max)));
			} 
		}
	}
	
	
	private static int countNum(long[] a , Long num) {
		int count = 0;
		for(long l : a) {
			if(l == num) {
				count++;
			}
		}
		return count;
	}
	
	private static long pow(int k) {
		long ans = 1;
		for(int i = 0; i < k; i++) {
			ans = (ans * 2) % MOD;
		}
		return ans;
	}
	
	private static long[] convertToLong(String str, int n) {
		StringTokenizer sToken = new StringTokenizer(str, " ");
		long[] l = new long[n];
		for(int i = 0; i < n; i++) {
			l[i] = (Long.parseLong(sToken.nextToken()));
		}
		return l;
	}
}